]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/SuperPolarity.cs
Protoshow sprint.
[rbdr/super-polarity] / Super Polarity / SuperPolarity.cs
index 6689167f16aed7939c044b54e4fffdcc08cf1d7a..8125f8cdcea147b608d2f4b5c074bd577201cee3 100644 (file)
@@ -7,6 +7,8 @@ using Microsoft.Xna.Framework.Graphics;
 using Microsoft.Xna.Framework.Input;
 using Microsoft.Xna.Framework.Storage;
 using Microsoft.Xna.Framework.GamerServices;
+using Microsoft.Xna.Framework.Media;
+using Microsoft.Xna.Framework.Audio;
 using SuperPolarity;
 #endregion
 
@@ -26,7 +28,9 @@ namespace SuperPolarity
 
         Screen EntryScreen;
 
-        SpriteFont DebugFont;
+        protected Song TitleSong;
+        protected Song GameSong;
+        protected SoundEffect GameOverSound;
 
         public SuperPolarity()
             : base()
@@ -43,7 +47,7 @@ namespace SuperPolarity
             ActorManager.SetGame(this);
             ScreenManager.SetGame(this);
 
-            EntryScreen = (Screen)new GameScreen(this);
+            EntryScreen = (Screen)new TitleScreen(this);
         }
 
         /// <summary>
@@ -60,7 +64,6 @@ namespace SuperPolarity
             InputController.Bind("fullScreenToggle", HandleFullScreenToggle);
 
             EntryScreen.Initialize();
-            ScreenManager.Push(EntryScreen);
 
             OutlierBounds = 100;
         }
@@ -77,13 +80,17 @@ namespace SuperPolarity
         /// </summary>
         protected override void LoadContent()
         {
+
+            MediaPlayer.IsRepeating = true;
+            GameSong = Content.Load<Song>("Sound\\polaritytheme.wav");
+            GameOverSound = Content.Load<SoundEffect>("Sound\\gameover");
+
             // Create a new SpriteBatch, which can be used to draw textures.
             spriteBatch = new SpriteBatch(GraphicsDevice);
 
-            EntryScreen.LoadContent();
+            ScreenManager.Push(EntryScreen);
 
-            Player = new Player();
-            DebugFont = Content.Load<SpriteFont>("Fonts\\SegoeUIMono14");
+            Player = new Player(this);
         }
 
         /// <summary>
@@ -107,6 +114,8 @@ namespace SuperPolarity
 
             ScreenManager.Update(gameTime);
 
+            Player.Update();
+
             base.Update(gameTime);
         }
 
@@ -122,13 +131,25 @@ namespace SuperPolarity
 
             ScreenManager.Draw(spriteBatch);
 
-            spriteBatch.DrawString(DebugFont, "Score: " + Player.Score.ToString(), new Vector2(10, 10), Color.LightGray);
-            spriteBatch.DrawString(DebugFont, "Multiplier: " + Player.Multiplier.ToString(), new Vector2(10, 30), Color.LightGray);
-            spriteBatch.DrawString(DebugFont, "Lives: " + Player.Lives.ToString(), new Vector2(10, 50), Color.LightGray);
-
             spriteBatch.End();
 
             base.Draw(gameTime);
         }
+
+        public void PlaySong(string songName)
+        {
+            // temp stuff before media manager is in
+            if (songName == "game")
+            {
+                MediaPlayer.Play(GameSong);
+            }
+        }
+
+        public void GameOver()
+        {
+            MediaPlayer.Stop();
+            GameOverSound.Play();
+            ScreenManager.Pop();
+        }
     }
 }